<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<jsp:include page="../../head.jsp"/>
<style>
    * {
        margin: 0;
        padding: 0;
        text-decoration: none;
        font-family: "微软雅黑";
    }

    .contion_password {
        padding-left: 20px;
    }

    h4 {
        line-height: 50px;
    }

    .contion_password p span {
        color: #f00;
    }

    p {
        line-height: 30px;
    }

    .contion_password h4 a {
        text-decoration: underline;
        font-weight: normal;
    }

    .jw-title {
        color: #fff;

    }

    .jw-dialog-hd {
        background-color: #0080ff;
    }

    .title {
        text-align: center;
        text-align: justify;
        text-justify: distribute-all-lines;
        text-align-last: justify
    }
</style>
<script type="text/javascript">
    function resetPwd(cmdStr) {
        if (cmdStr == "show") {
            layer.open({
                           type: 1,
                           title: '修改密码',
                           content: $('#resetPwdDiv'),
                           btn: '提交',
                           cache: false,
                           yes: function () {
                               resetPwd("submit");
                           },
                           success: function (layero) {
                               var btn = layero.find('.layui-layer-btn');
                               btn.css('text-align', 'center');
                           },
                           cancel: function () {
                               $("#oldpwd").val('');
                               $("#newpwd").val('');
                               $("#confirm").val('');
                           }
                       });
        }
        else if (cmdStr == "submit") {
            var cpwd = $("#oldpwd").val();
            var newpwd = $("#newpwd").val();
            var confirm = $("#confirm").val();
            if (!cpwd) {
                layer.alert("请输入原密码");
                return;
            } else if (!newpwd) {
                layer.alert("请输入新密码");
                return;
            } else if (!confirm) {
                layer.alert("确认新密码没有填写");
                return;
            }
            if (newpwd != confirm) {
                layer.alert("两次输入的密码不一致");
                return;
            }
            $.ajax({
                       url: "company-resetPwd",
                       async: false,
                       data: {cpwd: cpwd, newpwd: newpwd},
                       success: function (data) {
                           layer.alert(data.data, {title: false},
                                       function (index) {
                                           if (data.result || data.result == "true") {
                                               location.href = "company-bizShowUser";
                                           } else {
                                               layer.close(index);
                                           }
                                       });
                       }
                   });
        }
    }
</script>

<body>
<div class="contion_password">
    <h4>忘记密码</h4>
    <p>
        联系平台客服热线：<span>0757-83930642</span>，请求重置密码。
    </p>
    <h4>
        修改密码
    </h4>
    <p>进入平台后，点击帮助中心-密码设置进行密码修改</p>

</div>
<div style="height:300px;*text-align:center;/*margin-left: 30%;*/">
    <table style="font-size:16px;width:340px;margin:0 auto; margin-top: 100px;" border=2
           cellSpacing=0
           borderColor=#cccccc cellPadding=3 bgColor=#ffffff>
        <tr>
            <td style="background-color:#e1f3ff;width:100px; line-height:40px;border:1px solid #cccccc;">
                <P align=right>&nbsp;登录帐号：</P></td>
            <td style="padding-left:10px;">
                <P align=left>
                    ${user.account}
                </P></td>
        </tr>
        <tr>
            <td style="background-color:#e1f3ff;width:100px; line-height:40px;border:1px solid #cccccc;">
                <P align=right>&nbsp;姓名：</P></td>
            <td style="padding-left:10px;">
                <P align=left>
                    ${user.name}
                </P></td>
        </tr>
        <tr>
            <td style="background-color:#e1f3ff;width:100px; line-height:40px;border:1px solid #cccccc;">
                <P align=right>&nbsp;联系电话：</P></td>
            <td style="padding-left:10px;">
                <P align=left>
                    ${user.mobile}
                </P></td>
        </tr>
        <tr>
            <td colspan="2" align="center"
                style="background-color:#f2f2f2;line-height:40px;border:1px solid #fff;font-weight:bold;">
                <a><!--修改密码  -->
                    <button onclick="resetPwd('show');"
                            style=" margin-top:6px;margin-bottom:6px;border-color: transparent;background-image: url('../img/xiugaimima.png'); background-repeat:no-repeat;width:90px;height: 28px; border:none; cursor: pointer;">
                </a>

            </td>
        </tr>
    </table>
    <div id="resetPwdDiv" style="display:none;padding:20px">
        <table style="border-collapse:separate; border-spacing:0px 10px;">
            <tr>
                <td class="title">旧密码：</td>
                <td><input id="oldpwd" type="password"/></td>
            </tr>
            <tr>
                <td class="title"/>
                <td id="newpwdCheck"/>
            </tr>
            <tr>
                <td class="title">新密码：</td>
                <td><input id="newpwd" type="password"/></td>
            </tr>
            <tr>
                <td class="title"/>
                <td id="confirmCheck"/>
            </tr>
            <tr>
                <td class="title">确认新密码：</td>
                <td><input id="confirm" type="password"/></td>
            </tr>
        </table>
    </div>
</div>
</body>
